package come.niit.daoimpl;

import come.niit.dao.Student4Dao;
import come.niit.util.HiveUtil;
import come.niit.vo.Show_Data4;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

public class Student4DaoImpl implements Student4Dao {
    public Show_Data4 getNums() {
        String sql = "SELECT * from ads_stuInfo";
        ResultSet rs = HiveUtil.getRS(sql);
        List<Integer> semesters = new ArrayList<>();
        List<Integer>  male_counts = new ArrayList<>();
        List<Integer>  female_counts = new ArrayList<>();
        Show_Data4 show_data4 = null ;
        try {
            while (rs.next()){
                Integer semester = rs.getInt(1);
                Integer male_count = rs.getInt(2);
                Integer female_count = rs.getInt(3);
                semesters.add(semester);
                male_counts.add(male_count);
                female_counts.add(female_count);
            }
            show_data4 = new Show_Data4(semesters, male_counts, female_counts);
        }catch (Exception e){
            e.printStackTrace();
        }
        return show_data4;
    }

}

